<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport"
    content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no" />
  <title>考勤管理</title>
  <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  <style>
    #main {
      display: -webkit-box;
      display: -webkit-flex;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-flex-flow: column;
      flex-flow: column;
    }

    #header {
      position: relative;
      background-color: #1abc9c;
      border-bottom: 1px solid #e0e0e0;
    }

    .logo {
      position: absolute;
      left: 20px;
      bottom: 13px;
      height: 25px;
    }

    h1 {
      height: 50px;
      line-height: 50px;
      font-size: 20px;
      color: #fff;
      font-weight: normal;
      margin: 0 auto;
      text-align: center;
    }
  </style>
</head>

<body>
  <div id="main">
    <header id="header">
      <img class="logo" src="../../image/ic_back_u.png" tapmode onclick="api.closeWin()" />
      <h1 id="title">
        考勤管理
        <span width="25px" class="toobarimg" style="float: right; margin-top: 2px; margin-right: 15px;font-size: 15px"
          onclick="openDetail('attr_addNew_win.html')" tapmode id="add">添加</span>
      </h1>
    </header>
  </div>
</body>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>
<script type="text/javascript">
  apiready = function () {
    var session = $api.getStorage('userSession');
    var roleId = session.data.sysRole.sysRoleCode.id;
    var thisday = new Date();
    thisday.setTime(thisday.getTime());
    var year = thisday.getFullYear();
    var month = thisday.getMonth() + 1;
    var day = thisday.getDate();
    if (month < 10) {
      month = "0" + month;
    }
    if (day < 10) {
      day = "0" + day;
    }
    var s = year + "-" + month + "-" + day;
    if (roleId === 4) {
      var session = $api.getStorage('userSession').data;
      // alert(session.team_id)
      var teamAddSession = $api.getStorage("teamAdd")
      console.log(teamAddSession)
      console.log(typeof teamAddSession)
      if (teamAddSession == '0') {
        $("#add").hide()
      } else {
        $("#add").show()
      }

      var $header = $api.dom("header");
      $api.fixIos7Bar($header);
      $api.fixStatusBar($header);
      var thridHeader = $api.offset(header);
      api.openFrame({
        name: "check_work_frame.html",
        url: "check_work_frame.html",
        rect: {
          x: 0,
          y: thridHeader.h,
          w: "auto",
          h: "auto",
        },
        pageParam: {},
        bounces: true,
        delay: 200,
      });
    } else if (roleId == 3 || roleId == 2) {
      $("#add").hide()
      var $header = $api.dom("header");
      $api.fixIos7Bar($header);
      $api.fixStatusBar($header);
      var thridHeader = $api.offset(header);
      api.openFrame({
        name: "att_management_frame.html",
        url: "att_management_frame.html",
        rect: {
          x: 0,
          y: thridHeader.h,
          w: "auto",
          h: "auto",
        },
        pageParam: {},
        bounces: true,
        delay: 200,
      });
    }
  };
</script>

</html>